package com.wanlian.dao;

import com.wanlian.common.PageCondition;
import com.wanlian.entity.Device;
import com.wanlian.entity.ScoreHistory;
import com.wanlian.model.ResultModel;
import com.wanlian.vo.Page;
import com.wanlian.vo.ScoreVo;

import java.util.List;
import java.util.Map;

public interface ScoreHistoryDao extends GenericDao<ScoreHistory> {

    /**
     * 获取设备积分记录
     *
     * @param page
     * @param conditions
     * @return
     */
    ResultModel queryScoreHistory(Page page, Map<String, Object> conditions);

    /**
     * 获取某台设备记录
     *
     * @param page
     * @param deviceId
     * @return
     */
    ResultModel queryScoreHistoryByDeviceId(Page page, int deviceId);


    /**
     * 获取某个设备昨日的积分记录
     *
     * @param page
     * @param deviceId
     * @return
     */
    ResultModel queryHistoryYestoryDayByDeviceId(Page page, int deviceId);


    /**
     * 获取用户昨日的设备积分记录
     *
     * @param userId
     * @return
     */
    List<ScoreHistory> queryHistoryByYesAndUserId(int userId);

    /**
     * 获取用户的设备积分记录
     *
     * @param page
     * @param userId
     * @return
     */
    ResultModel queryHistoryByUserId(Page page, int userId);

    ResultModel queryDeviceScoreHistoryByParam(PageCondition pageCondition, int userId);


    double querySumScoreYes();

    /**
     * 查询用户当天是否兑换int
     *
     * @param userId
     * @return
     */
    long queryChangeIntToday(int userId);

    List<Map<String, Object>> querySumScoreListYes();

    void addOrUpdateShareScore(Device device, ScoreVo vo);

    void deleteShareScore(Device device);

}
